const FD_ID_FLAG = 'data-feidao-id';

/**
 * 通过id获取dom
 * @param node 节点对象
 * @param id 节点id或data-feidao-id
 */
export default function get_dom_by_id(node: HTMLElement, id: string) {
	const n_id = node.id;
	if (n_id === id) {
		return node;
	}
	const dom = node.querySelector('[id="' + id + '"]');
	if (dom) {
		return dom as HTMLElement;
	} else {
		return node.querySelector(`[${FD_ID_FLAG}='${id}']`) as HTMLElement;
	}
}
